<?php
/**
 * Created by PhpStorm.
 * User: sh01
 * Date: 2017/12/22
 * Time: 15:12
 */

class AutoLoad
{
    //项级域名与对应上当的映射
    public static $topNameSpace = 'app';
    public static $rootDir = __DIR__;
    public function _autoLoad($className)
    {
        //类名转换为路径
        $path = substr_replace($className,self::$rootDir,0,strlen(self::$topNameSpace)).'php';
        require $path;
    }
}

//功能测试
//$autLoad = new AutoLoad();
//$autLoad->_autoLoad('app\\a\\b\\c');